// 基于template/src/widgets/\{{appEntities}}/\{{ctrls@TREEVIEW}}-tree/\{{spinalCase ctrl.codeName}}-tree-model.ts.hbs生成
import { ITreeModel, ITreeNodeModel, ITreeNodeRsModel } from "@/core";

function getModel(): ITreeModel {
    return {
        name: "{{ctrl.name}}",
        caption: "{{ctrl.caption}}",
        codeName: "{{ctrl.codeName}}",
        cssName: "{{#if ctrl.psSysCss}}{{ctrl.psSysCss.cssName}}{{/if}}",
        controlType: "{{ctrl.controlType}}",
        entityCodeName: "{{ctrl.psAppDataEntity.codeName}}",
        rootVisible: {{ctrl.rootVisible}},
        treeNodes: getTreeNodes(),
        treeNodeRSs: getTreeNodeRSs(),
        {{> @macro/common/counter.hbs page=ctrl}}
    }
}

function getTreeNodes(): ITreeNodeModel[] {
    return [
        {{> @macro/widgets/tree-detail/tree-node.hbs nodes=ctrl.psDETreeNodes}}
    ]
}

function getTreeNodeRSs(): ITreeNodeRsModel[] {
    return [
        {{> @macro/widgets/tree-detail/tree-node-rss.hbs treeNodeRSs=ctrl.psDETreeNodeRSs}}
    ]
}
export const model = getModel();
